package com.MyDemo.demo.strategy;

import java.util.List;
import java.util.Objects;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.MyDemo.demo.domain.dto.FilterTestDTO;

public class AcceptRule implements IProcessRule {
    Logger logger = LoggerFactory.getLogger(DistanceRule.class);

    private IProcessRule next;

    public AcceptRule(IProcessRule next) {
        this.next = next;
    }

    public AcceptRule() {
        this.next = null;
    }

    @Override
    public List<FilterTestDTO> filter(List<FilterTestDTO> filterTestDTOList) {
        if (Objects.isNull(this.next)) {
            logger.error("aaa");
        }

        if (!Objects.isNull(this.next)) {
            List<FilterTestDTO> filtedList = next.filter(filterTestDTOList);
            logger.error("aaanext");
            return filtedList;
        }
        return null;
    }

    @Override
    public IProcessRule next() {
        return this.next;
    }

}
